package 拷贝;

import 注解.Person;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.stream.Collectors;

/**
 * @author:谢君臣
 * @Date:2021/10/20-15:34
 * @version:1.0
 * @function:
 */
public class 浅拷贝 {
    public static void main(String[] args) {
        int [] arr = new int[10];
        arr[1] =1;
        arr[3] =2;
        arr[5] =4;
        int[] clone = arr.clone();
        clone[1]=1;
        System.out.println();
        ArrayList arrayList = new ArrayList(Arrays.asList(arr));
        ArrayList clone1 = (ArrayList) arrayList.clone();
        clone1.add(10);
        System.out.println(arrayList.size()+" "+clone1.size());

        HashMap<String,int[]> hashMap = new HashMap<>();
        hashMap.put("ada",arr);
        HashMap<String,int[]> clone2 = (HashMap) hashMap.clone();
        clone2.get("ada")[1]= -1;
        System.out.println(hashMap.size());

        int [][] a = new int[2][2];
        int[][] ints = a.clone();
        ints[1][1] = 10;
        System.out.println(a[1][1]);

    }
}
